home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 June
/
Macworld (1999-06).dmg
/
Shareware World
/
Info
/
For Developers
/
MacZoop2.0.sea
/
MacZoop2.0
/
Required Classes
/
ZDefines.h
< prev
next >
Wrap
Text File
|
1999-02-11
|
4KB
|
167 lines
/*************************************************************************************************
*
*
* MacZoop 2.0 - "the framework for the rest of us"
*
*
*
* ZDefines.h -- some handy constants, etc
*
*
*
*
*
* © 1996, Graham Cox
*
*
*
*
*************************************************************************************************/
#pragma once
#ifndef __ZDEFINES__
#define __ZDEFINES__
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NIL
#define NIL NULL
#endif
// standard basic resource IDs, etc.
#define kUntitledWindowID 128 // resource ID of the main window template
#define kAppleMenuID 128 // ID of the apple menu
#define kFileMenuID 129 // ID of File menu
#define kEditMenuID 130 // ID of Edit menu
#define kAboutBoxID 128
#define kStdMenubarID 128 // ID of the default MBAR resource for the main menu bar
#define kMiscStrListID 128
#define kExceptionAlertID 130
#define kMemoryLowAlertID 132
#define kAssertionAlertID 138
#define kSleepTime 10 // number of ticks to give up to background programs
#define kStdScrollbarWidth 15 // pixel width/height of normal scrollbar
// save changes alert constants
#define kConfirmSaveAlertID 129
enum
{
kConfirmSave = 1,
kCloseCancel,
kCloseNoSave
};
// macros for extracting window/dialog object references from mac windows
#define IS_ZWINDOW_KIND 772 // in the 'kind' field of the window record
#define GetZWindow(w) ((((WindowPeek) w)->windowKind == IS_ZWINDOW_KIND) || \
(((WindowPeek) w)->windowKind == dialogKind))? \
(ZWindow*) GetWRefCon(w) : NULL
// handy object disposal macros
#define ForgetObject(p) { delete (p); (p) = NULL; }
#define ForgetThis() { delete this; }
// common useful macros. Be careful passing functions to these, you may get poor
// performance and/or incorrect results.
#define MIN( a, b ) (((a) < (b))? (a) : (b))
#define MAX( a, b ) (((a) > (b))? (a) : (b))
#define ABS( x ) (((x) < 0 )? -(x) : (x))
#define CMP( a, b ) (((a) < (b))? -1 : (((a) > (b))? 1 : 0 ))
#define SGN( a ) (((a) < 0 )? -1 : 1 )
// macros for compile-time string hacking:
#define CLITERAL( x ) #x
#define PLITERAL( x ) CLITERAL( \p##x )
#define HEADER( x ) CLITERAL( x.h )
// can be passed to SetCursorShape() to set cursor to these shapes:
#define ARROW_CURSOR 0
#define WIN_ARROW_CURSOR 199
#define CONTEXT_MENU_CURSOR 136
#define HAND_CURSOR 137
#define HAND_CURSOR_CLOSED 138
// common non-ascii keys
#define TAB_KEY 0x09
#define RETURN_KEY 0x0D
#define ENTER_KEY 0x03
#define ESCAPE_KEY 0x1B
#define UP_ARROW_KEY 0x1E
#define DOWN_ARROW_KEY 0x1F
#define LEFT_ARROW_KEY 0x1C
#define RIGHT_ARROW_KEY 0x1D
#define BACKSPACE_KEY 0x08
// pseudo-modifier key
#define FromAutoKeyEvent 0x0040 // added to modifiers field for keyboard input
// undefined and quiet exceptions
#define kUnknownExceptionErr 999 // catch all error code
#define kRuntimeLibException 998 // runtime lib threw exception (bad alloc, etc)
#define kSilentErr -1 // no alert message for this error
#define kMacZoopParamErr 950 // NULL Ptr, Handle passed as parameter
#define kMacZoopParamErr1 951 // Other parameter not correct
#define kMacZoopNULLPtrErr 952 // NULL Ptr where it wasn't expected
#define kUnknownSignature '????'
// current MacZoop version number & release stage:
#define MACZOOP_VERSION 0x0200 // current version number
enum
{
k_Version_Alpha,
k_Version_Beta,
k_Version_Final_Candidate,
k_Version_Release
};
#define MACZOOP_VERSION_STAGE k_Version_Final_Candidate
// global structure provides some common gestalt results
typedef struct
{
Boolean supportsColour; // colour quickdraw available
Boolean hasDragManager; // drag manager available
Boolean hasFPU; // has a floating-point coprocessor
Boolean hasAppleEvents; // has apple events
Boolean hasAppearanceMgr; // has the appearance manager
Boolean hasQuickTime; // has QuickTime available
Boolean hasImgCompressionMgr; // the Image Compression Manager is available
Boolean hasNavigationServices; // Nav Services installed & available
Boolean hasContextualMenus; // Contextual menu services available
short systemVersion; // current system version number
}
tMacInfo;
#endif